In [2]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

Extract data¶

In [3]:
# Enable autocompletion
%config Completer.use_jedi = True
In [4]:
import os
In [7]:
os.listdir(r'C:\Users\kbsha\Downloads\Leeds\Reading List\Python\Uber\Datasets')
Out[7]:
['other-American_B01362.csv',
 'other-Carmel_B00256.csv',
 'other-Dial7_B00887.csv',
 'other-Diplo_B01196.csv',
 'other-Federal_02216.csv',
 'other-FHV-services_jan-aug-2015.csv',
 'other-Firstclass_B01536.csv',
 'other-Highclass_B01717.csv',
 'other-Lyft_B02510.csv',
 'other-Prestige_B01338.csv',
 'other-Skyline_B00111.csv',
 'Uber-Jan-Feb-FOIL.csv',
 'uber-raw-data-apr14.csv',
 'uber-raw-data-aug14.csv',
 'uber-raw-data-janjune-15.csv',
 'uber-raw-data-janjune-15_sample.csv',
 'uber-raw-data-jul14.csv',
 'uber-raw-data-jun14.csv',
 'uber-raw-data-may14.csv',
 'uber-raw-data-sep14.csv']
In [ ]:
 
In [9]:
uber_data = pd.read_csv(r'C:\Users\kbsha\Downloads\Leeds\Reading List\Python\Uber\Datasets\uber-raw-data-janjune-15_sample.csv')
In [11]:
uber_data.shape
Out[11]:
(100000, 4)

Data preprocessing¶

In [12]:
# check for duplicate rows, if corresponding row return false then its not duplicate else it is.
uber_data.duplicated()
Out[12]:
0        False
1        False
2        False
3        False
4        False
         ...  
99995    False
99996    False
99997    False
99998    False
99999    False
Length: 100000, dtype: bool
In [13]:
# As we can see it has 54 duplicate rows
uber_data.duplicated().sum()
Out[13]:
54
In [15]:
# to remove duplicate rows and replace it in the main file, use the following code
uber_data.drop_duplicates(inplace=True)
In [18]:
# Now, the dataset has no duplicate rows
uber_data.duplicated().sum()
Out[18]:
0
In [19]:
uber_data.shape
Out[19]:
(99946, 4)
In [20]:
# to check the datatype use the below code
uber_data.dtypes
Out[20]:
Dispatching_base_num    object
Pickup_date             object
Affiliated_base_num     object
locationID               int64
dtype: object
In [22]:
# Now let us check the dataset has null values, as we can see the below code result Affiliated_base_num as 1116 null values
uber_data.isnull().sum()
Out[22]:
Dispatching_base_num       0
Pickup_date                0
Affiliated_base_num     1116
locationID                 0
dtype: int64
In [23]:
uber_data['Pickup_date']
Out[23]:
0        2015-05-02 21:43:00
1        2015-01-20 19:52:59
2        2015-03-19 20:26:00
3        2015-04-10 17:38:00
4        2015-03-23 07:03:00
                ...         
99995    2015-04-13 16:12:00
99996    2015-03-06 21:32:00
99997    2015-03-19 19:56:00
99998    2015-05-02 16:02:00
99999    2015-06-24 16:04:00
Name: Pickup_date, Length: 99946, dtype: object
In [24]:
# The code result shows that Pickup_date has string data type, we shall convert it into datatime datatype
uber_data['Pickup_date'] = pd.to_datetime(uber_data['Pickup_date'])
In [25]:
type(uber_data['Pickup_date'])
Out[25]:
pandas.core.series.Series
In [28]:
uber_data.dtypes
Out[28]:
Dispatching_base_num            object
Pickup_date             datetime64[ns]
Affiliated_base_num             object
locationID                       int64
dtype: object

EDA¶

Problem statements :-¶

1. Which month has maximum pickups in the New York city?.¶

In [34]:
'''From the below code we can understand that the dataset do not have month column to find the max 
pickups but we have pickup data column, we shall extract the required columns form Pickups column
'''

uber_data
Out[34]:
Dispatching_base_num Pickup_date Affiliated_base_num locationID
0 B02617 2015-05-02 21:43:00 B02764 237
1 B02682 2015-01-20 19:52:59 B02682 231
2 B02617 2015-03-19 20:26:00 B02617 161
3 B02764 2015-04-10 17:38:00 B02764 107
4 B02764 2015-03-23 07:03:00 B00111 140
... ... ... ... ...
99995 B02764 2015-04-13 16:12:00 B02764 234
99996 B02764 2015-03-06 21:32:00 B02764 24
99997 B02598 2015-03-19 19:56:00 B02598 17
99998 B02682 2015-05-02 16:02:00 B02682 68
99999 B02764 2015-06-24 16:04:00 B02764 125

99946 rows × 4 columns

In [37]:
uber_data['Pickup_date'].dt.month_name()
uber_data['month'] = uber_data['Pickup_date'].dt.month_name()
In [38]:
uber_data
Out[38]:
Dispatching_base_num Pickup_date Affiliated_base_num locationID month
0 B02617 2015-05-02 21:43:00 B02764 237 May
1 B02682 2015-01-20 19:52:59 B02682 231 January
2 B02617 2015-03-19 20:26:00 B02617 161 March
3 B02764 2015-04-10 17:38:00 B02764 107 April
4 B02764 2015-03-23 07:03:00 B00111 140 March
... ... ... ... ... ...
99995 B02764 2015-04-13 16:12:00 B02764 234 April
99996 B02764 2015-03-06 21:32:00 B02764 24 March
99997 B02598 2015-03-19 19:56:00 B02598 17 March
99998 B02682 2015-05-02 16:02:00 B02682 68 May
99999 B02764 2015-06-24 16:04:00 B02764 125 June

99946 rows × 5 columns

In [40]:
# the dataset has month column, now check the frequency of each month using below code
uber_data['month'].value_counts() # its in desc order, month June has highest pickups 
Out[40]:
June        19620
May         18660
April       15982
March       15969
February    15896
January     13819
Name: month, dtype: int64
In [43]:
# Visulaize it using Line plot method
uber_data['month'].value_counts().plot()
Out[43]:
<Axes: >
In [44]:
# Visulaize it using bar plot
uber_data['month'].value_counts().plot(kind='bar')
Out[44]:
<Axes: >
In [47]:
''' The bar chart shows that June has highest and January has the least. If we want to go indept, we can also find which 
day has highest and lowest, but for this we need data in the tabular format  - cross tabulation'''

# In order to create pivot table, let us derive attributes from pickup date 

uber_data['weekday'] = uber_data['Pickup_date'].dt.day_name()
uber_data['day'] = uber_data['Pickup_date'].dt.day
uber_data['hour'] = uber_data['Pickup_date'].dt.hour
uber_data['minute'] = uber_data['Pickup_date'].dt.minute

uber_data
Out[47]:
Dispatching_base_num Pickup_date Affiliated_base_num locationID month weekday day hour minute
0 B02617 2015-05-02 21:43:00 B02764 237 May Saturday 2 21 43
1 B02682 2015-01-20 19:52:59 B02682 231 January Tuesday 20 19 52
2 B02617 2015-03-19 20:26:00 B02617 161 March Thursday 19 20 26
3 B02764 2015-04-10 17:38:00 B02764 107 April Friday 10 17 38
4 B02764 2015-03-23 07:03:00 B00111 140 March Monday 23 7 3
... ... ... ... ... ... ... ... ... ...
99995 B02764 2015-04-13 16:12:00 B02764 234 April Monday 13 16 12
99996 B02764 2015-03-06 21:32:00 B02764 24 March Friday 6 21 32
99997 B02598 2015-03-19 19:56:00 B02598 17 March Thursday 19 19 56
99998 B02682 2015-05-02 16:02:00 B02682 68 May Saturday 2 16 2
99999 B02764 2015-06-24 16:04:00 B02764 125 June Wednesday 24 16 4

99946 rows × 9 columns

In [49]:
# use month as index or row and use weekday as column and store it in pivot object

pivot = pd.crosstab(index=uber_data['month'], columns=uber_data['weekday'])
pivot
Out[49]:
weekday Friday Monday Saturday Sunday Thursday Tuesday Wednesday
month
April 2365 1833 2508 2052 2823 1880 2521
February 2655 1970 2550 2183 2396 2129 2013
January 2508 1353 2745 1651 2378 1444 1740
June 2793 2848 3037 2485 2767 3187 2503
March 2465 2115 2522 2379 2093 2388 2007
May 3262 1865 3519 2944 2627 2115 2328
In [51]:
# In order to show day wise, let us crete group bar chart
pivot.plot(kind='bar', figsize=(8,6))
Out[51]:
<Axes: xlabel='month'>

2. Find out Hourly Rush in New York city on all days¶

To find the trend we do not have count of weekday on hour basis, like COUNT of pikeups on friday at hour 1, hour 2... till hour 24

Previoulsy we have derived attributes like weekday and hour.. using group by function, pass weekday and hour as arguments find the total count.

In [ ]:
uber_data.groupby(['weekday', 'hour']).size()
In [54]:
# If we want this datafram set as_index=False and assign to summary 

summary= uber_data.groupby(['weekday', 'hour'], as_index=False).size()
In [55]:
summary
Out[55]:
weekday hour size
0 Friday 0 581
1 Friday 1 333
2 Friday 2 197
3 Friday 3 138
4 Friday 4 161
... ... ... ...
163 Wednesday 19 1044
164 Wednesday 20 897
165 Wednesday 21 949
166 Wednesday 22 900
167 Wednesday 23 669

168 rows × 3 columns

In [59]:
# Using pointplot, we can easily display the trend of the each weekday on hour basis, from seanborn module, call pointplot,
plt.figure(figsize=(10,6))
sns.pointplot(x='hour', y='size', hue='weekday', data=summary)
Out[59]:
<Axes: xlabel='hour', ylabel='size'>

By examining the pointplot, it becomes apparent that pickups generally increase during the evening throughout the entire week. Notably, on Saturday and Friday, pickups consistently rise progressively into the late night hours, following a similar pattern observed on Thursday, albeit with a slight decrease in pickups during the late night period.

3. Which Base number has most number of Active Vehicles?¶

In [63]:
# We need to import another dataset for this activity
uber_foil = pd.read_csv(r'C:\Users\kbsha\Downloads\Leeds\Reading List\Python\Uber\Datasets\Uber-Jan-Feb-FOIL.csv')
In [64]:
uber_foil
Out[64]:
dispatching_base_number date active_vehicles trips
0 B02512 1/1/2015 190 1132
1 B02765 1/1/2015 225 1765
2 B02764 1/1/2015 3427 29421
3 B02682 1/1/2015 945 7679
4 B02617 1/1/2015 1228 9537
... ... ... ... ...
349 B02764 2/28/2015 3952 39812
350 B02617 2/28/2015 1372 14022
351 B02682 2/28/2015 1386 14472
352 B02512 2/28/2015 230 1803
353 B02765 2/28/2015 747 7753

354 rows × 4 columns

In [71]:
# null values
uber_foil.isnull().sum()
Out[71]:
dispatching_base_number    0
date                       0
active_vehicles            0
trips                      0
dtype: int64
In [ ]:
 
In [72]:
# Duplicate values
uber_foil.duplicated().sum()
Out[72]:
0
In [73]:
uber_foil.columns
Out[73]:
Index(['dispatching_base_number', 'date', 'active_vehicles', 'trips'], dtype='object')
In [80]:
# Let us us use box plot from seanborn module to show the distribution of active vehicles
plt.figure(figsize=(10,6))
sns.boxplot(x='dispatching_base_number', y='active_vehicles', data=uber_foil)

# Adding a summary table
summary_table = uber_foil.groupby('dispatching_base_number')['active_vehicles'].describe()
summary_table = summary_table.reset_index()  # Reset index for better display
summary_table.columns = ['Dispatching Base Number', 'Count', 'Mean', 'Std', 'Min', '25%', '50%', '75%', 'Max']

# Displaying the summary table
print("Summary of Active Vehicles per Dispatching Base Number:")
print(summary_table)

plt.show()
Summary of Active Vehicles per Dispatching Base Number:
  Dispatching Base Number  Count         Mean         Std     Min     25%  \
0                  B02512   59.0   222.457627   33.423264   112.0   203.5   
1                  B02598   59.0   994.118644  134.303579   434.0   936.5   
2                  B02617   59.0  1351.830508  161.360290   596.0  1274.5   
3                  B02682   59.0  1210.694915  190.817773   600.0  1088.0   
4                  B02764   59.0  3682.881356  438.326444  1619.0  3488.5   
5                  B02765   59.0   382.627119  180.135476   135.0   250.0   

      50%     75%     Max  
0   230.0   245.0   281.0  
1  1011.0  1077.0  1216.0  
2  1367.0  1456.5  1590.0  
3  1235.0  1338.0  1523.0  
4  3734.0  3955.5  4395.0  
5   296.0   528.5   786.0  

Analysis¶

Collect entire data and make it ready for the data analysis¶

In [94]:
files = os.listdir(r'C:\Users\kbsha\Downloads\Leeds\Reading List\Python\Uber\Datasets')
files
Out[94]:
['other-American_B01362.csv',
 'other-Carmel_B00256.csv',
 'other-Dial7_B00887.csv',
 'other-Diplo_B01196.csv',
 'other-Federal_02216.csv',
 'other-FHV-services_jan-aug-2015.csv',
 'other-Firstclass_B01536.csv',
 'other-Highclass_B01717.csv',
 'other-Lyft_B02510.csv',
 'other-Prestige_B01338.csv',
 'other-Skyline_B00111.csv',
 'Uber-Jan-Feb-FOIL.csv',
 'uber-raw-data-apr14.csv',
 'uber-raw-data-aug14.csv',
 'uber-raw-data-janjune-15.csv',
 'uber-raw-data-janjune-15_sample.csv',
 'uber-raw-data-jul14.csv',
 'uber-raw-data-jun14.csv',
 'uber-raw-data-may14.csv',
 'uber-raw-data-sep14.csv']
In [95]:
files = files[-8:]
In [96]:
files
Out[96]:
['uber-raw-data-apr14.csv',
 'uber-raw-data-aug14.csv',
 'uber-raw-data-janjune-15.csv',
 'uber-raw-data-janjune-15_sample.csv',
 'uber-raw-data-jul14.csv',
 'uber-raw-data-jun14.csv',
 'uber-raw-data-may14.csv',
 'uber-raw-data-sep14.csv']
In [97]:
files.remove('uber-raw-data-janjune-15.csv')
files.remove('uber-raw-data-janjune-15_sample.csv')
In [98]:
# There are 6 files, let us combine all 6 files into one single file
files
Out[98]:
['uber-raw-data-apr14.csv',
 'uber-raw-data-aug14.csv',
 'uber-raw-data-jul14.csv',
 'uber-raw-data-jun14.csv',
 'uber-raw-data-may14.csv',
 'uber-raw-data-sep14.csv']
In [99]:
# Create one blank datafram
final = pd.DataFrame()
In [103]:
# Using for loop concatnate all files into final file
path = r'C:\Users\kbsha\Downloads\Leeds\Reading List\Python\Uber\Datasets'
for file in files:
    cdf=pd.read_csv(path + '/' + file)
    final = pd.concat([final, cdf])
In [105]:
final.shape
Out[105]:
(4534327, 4)
In [107]:
final.drop_duplicates(inplace=True)
In [108]:
final.shape
Out[108]:
(4451746, 4)
In [111]:
final.head(4)
# Sections running from top to bottom = Lon (360 degree)
# Sections running from west to east = Lat (180 degree)
Out[111]:
Date/Time Lat Lon Base
0 4/1/2014 0:11:00 40.7690 -73.9549 B02512
1 4/1/2014 0:17:00 40.7267 -74.0345 B02512
2 4/1/2014 0:21:00 40.7316 -73.9873 B02512
3 4/1/2014 0:28:00 40.7588 -73.9776 B02512

Using above dataset we can perform Spacial Analysis¶

Problem statement¶

At what location of New York city are getting rush?¶

In [114]:
# This can be achieved using mapbased visulaisation
uber_rush = final.groupby(['Lat','Lon'], as_index=False).size()
In [115]:
uber_rush
Out[115]:
Lat Lon size
0 39.6569 -74.2258 1
1 39.6686 -74.1607 1
2 39.7214 -74.2446 1
3 39.8416 -74.1512 1
4 39.9055 -74.0791 1
... ... ... ...
574553 41.3730 -72.9237 1
574554 41.3737 -73.7988 1
574555 41.5016 -72.8987 1
574556 41.5276 -72.7734 1
574557 42.1166 -72.0666 1

574558 rows × 3 columns

In [123]:
!pip install folium
Requirement already satisfied: folium in c:\users\kbsha\anaconda3\lib\site-packages (0.15.1)
Requirement already satisfied: branca>=0.6.0 in c:\users\kbsha\anaconda3\lib\site-packages (from folium) (0.7.0)
Requirement already satisfied: numpy in c:\users\kbsha\anaconda3\lib\site-packages (from folium) (1.23.5)
Requirement already satisfied: xyzservices in c:\users\kbsha\anaconda3\lib\site-packages (from folium) (2023.10.1)
Requirement already satisfied: jinja2>=2.9 in c:\users\kbsha\anaconda3\lib\site-packages (from folium) (3.1.2)
Requirement already satisfied: requests in c:\users\kbsha\anaconda3\lib\site-packages (from folium) (2.28.1)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\kbsha\anaconda3\lib\site-packages (from jinja2>=2.9->folium) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\kbsha\anaconda3\lib\site-packages (from requests->folium) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\kbsha\anaconda3\lib\site-packages (from requests->folium) (2023.5.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\kbsha\anaconda3\lib\site-packages (from requests->folium) (1.26.14)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\kbsha\anaconda3\lib\site-packages (from requests->folium) (2.0.4)
In [124]:
import folium
In [126]:
# Let us pass this world coordination dataset to map function from folim package
basemap = folium.Map()
In [127]:
basemap
Out[127]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [128]:
from folium.plugins import HeatMap

HeatMap(uber_rush).add_to(basemap)
Out[128]:
<folium.plugins.heat_map.HeatMap at 0x29d3abcb940>
In [129]:
# The brid spot indicates that rush
basemap
Out[129]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Problem Statement¶

Examine rush on hour and weekday (Pair wise analysis)¶

In [131]:
# This can be achieved when we have dataset hour(1 to 24) vs days( Ex : 1 to 30)
final.head(4)
Out[131]:
Date/Time Lat Lon Base
0 4/1/2014 0:11:00 40.7690 -73.9549 B02512
1 4/1/2014 0:17:00 40.7267 -74.0345 B02512
2 4/1/2014 0:21:00 40.7316 -73.9873 B02512
3 4/1/2014 0:28:00 40.7588 -73.9776 B02512
In [132]:
final.dtypes
Out[132]:
Date/Time     object
Lat          float64
Lon          float64
Base          object
dtype: object
In [134]:
#Convert Data/Time column into proper format
final['Date/Time'] = pd.to_datetime(final['Date/Time'], format='%m/%d/%Y %H:%M:%S')
In [136]:
final['Date/Time'].dtype
Out[136]:
dtype('<M8[ns]')
In [137]:
# Now derive attributes from Date/Time
final['day'] = final['Date/Time'].dt.day
final['hour'] = final['Date/Time'].dt.hour
final
Out[137]:
Date/Time Lat Lon Base day hour
0 2014-04-01 00:11:00 40.7690 -73.9549 B02512 1 0
1 2014-04-01 00:17:00 40.7267 -74.0345 B02512 1 0
2 2014-04-01 00:21:00 40.7316 -73.9873 B02512 1 0
3 2014-04-01 00:28:00 40.7588 -73.9776 B02512 1 0
4 2014-04-01 00:33:00 40.7594 -73.9722 B02512 1 0
... ... ... ... ... ... ...
1028131 2014-09-30 22:57:00 40.7668 -73.9845 B02764 30 22
1028132 2014-09-30 22:57:00 40.6911 -74.1773 B02764 30 22
1028133 2014-09-30 22:58:00 40.8519 -73.9319 B02764 30 22
1028134 2014-09-30 22:58:00 40.7081 -74.0066 B02764 30 22
1028135 2014-09-30 22:58:00 40.7140 -73.9496 B02764 30 22

4451746 rows × 6 columns

In [142]:
# Create pair wise dataset using unstack method
pivot = final.groupby(['day','hour']).size().unstack()
In [143]:
pivot
Out[143]:
hour 0 1 2 3 4 5 6 7 8 9 ... 14 15 16 17 18 19 20 21 22 23
day
1 3178 1944 1256 1308 1429 2126 3664 5380 5292 4617 ... 6933 7910 8633 9511 8604 8001 7315 7803 6268 4050
2 2435 1569 1087 1414 1876 2812 4920 6544 6310 4712 ... 6904 8449 10109 11100 11123 9474 8759 8357 6998 5160
3 3354 2142 1407 1467 1550 2387 4241 5663 5386 4657 ... 7226 8850 10314 10491 11239 9599 9026 8531 7142 4686
4 2897 1688 1199 1424 1696 2581 4592 6029 5704 4744 ... 7158 8515 9492 10357 10259 9097 8358 8649 7706 5130
5 2733 1541 1030 1253 1617 2900 4814 6261 6469 5530 ... 6955 8312 9609 10699 10170 9430 9354 9610 8853 6518
6 4537 2864 1864 1555 1551 2162 3642 4766 4942 4401 ... 7235 8612 9444 9929 9263 8405 8117 8567 7852 5946
7 3645 2296 1507 1597 1763 2422 4102 5575 5376 4639 ... 7276 8474 10393 11013 10573 9472 8691 8525 7194 4801
8 2830 1646 1123 1483 1889 3224 5431 7361 7357 5703 ... 7240 8775 9851 10673 9687 8796 8604 8367 6795 4256
9 2657 1724 1222 1480 1871 3168 5802 7592 7519 5895 ... 7877 9220 10270 11910 11449 9804 8909 8665 7499 5203
10 3296 2126 1464 1434 1591 2594 4664 6046 6158 5072 ... 7612 9578 11045 11875 10934 9613 9687 9240 7766 5496
11 3036 1665 1095 1424 1842 2520 4954 6876 6871 5396 ... 7503 8920 10125 10898 10361 9327 8824 8730 7771 5360
12 3227 2147 1393 1362 1757 2710 4576 6250 6231 5177 ... 7743 9390 10734 11713 12216 10393 9965 10310 9992 7945
13 5408 3509 2262 1832 1705 2327 4196 5685 6060 5631 ... 8200 9264 10534 11826 11450 9921 8705 8423 7363 5936
14 3748 2349 1605 1656 1756 2629 4257 5781 5520 4824 ... 6963 8192 9511 10115 9553 9146 9182 8589 6891 4460
15 2497 1515 1087 1381 1862 2980 5050 6837 6729 5201 ... 7633 8505 10285 11959 11728 11032 10509 9105 7153 4480
16 2547 1585 1119 1395 1818 2966 5558 7517 7495 5958 ... 7597 9290 10804 11773 10855 10924 10142 10374 8094 5380
17 3155 2048 1500 1488 1897 2741 4562 6315 5882 4934 ... 7472 8997 10323 11236 11089 9919 9935 9823 8362 5699
18 3390 2135 1332 1626 1892 2959 4688 6618 6451 5377 ... 7534 9040 10274 10692 10338 9551 9310 9285 8015 5492
19 3217 2188 1604 1675 1810 2639 4733 6159 6014 5006 ... 7374 8898 9893 10741 10429 9701 10051 10049 9090 6666
20 4475 3190 2100 1858 1618 2143 3584 4900 5083 4765 ... 7462 8630 9448 10046 9272 8592 8614 8703 7787 5907
21 4294 3194 1972 1727 1926 2615 4185 5727 5529 4707 ... 7064 8127 9483 9817 9291 8317 8107 8245 7362 5231
22 2787 1637 1175 1468 1934 3151 5204 6872 6850 5198 ... 7337 9148 10574 10962 9884 8980 8772 8430 6784 4530
23 2546 1580 1136 1429 1957 3132 5204 6890 6436 5177 ... 7575 9309 9980 10341 10823 11347 11447 10347 8637 5577
24 3200 2055 1438 1493 1798 2754 4484 6013 5913 5146 ... 7083 8706 10366 10786 9772 9080 9213 8831 7480 4456
25 2405 1499 1072 1439 1943 2973 5356 7627 7078 5994 ... 7298 8732 9922 10504 10673 9048 8751 9508 8522 6605
26 3810 3065 2046 1806 1730 2337 3776 5172 5071 4808 ... 7269 8815 9885 10697 10867 10122 9820 10441 9486 7593
27 5196 3635 2352 2055 1723 2336 3539 4937 5053 4771 ... 7519 8803 9793 9838 9228 8267 7908 8507 7720 6046
28 4123 2646 1843 1802 1883 2793 4290 5715 5671 5206 ... 7341 8584 9671 9975 9132 8255 8309 7949 6411 4461
29 2678 1827 1409 1678 1948 3056 5213 6852 6695 5481 ... 7630 9249 10105 11113 10411 9301 9270 9114 6992 4323
30 2401 1510 1112 1403 1841 3216 5757 7596 7611 6064 ... 8396 10243 11554 12126 12561 11024 10836 10042 8275 4723
31 2174 1394 1087 919 773 997 1561 2169 2410 2525 ... 4104 5099 5386 5308 5350 4898 4819 5064 5164 3961

31 rows × 24 columns

In [146]:
# We can make the above more informative by providing background color, The darker color indicates more rush and lighter color 
# indicates reverse
pivot.style.background_gradient()
Out[146]:
hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
day                                                
1 3178 1944 1256 1308 1429 2126 3664 5380 5292 4617 4607 4729 4930 5794 6933 7910 8633 9511 8604 8001 7315 7803 6268 4050
2 2435 1569 1087 1414 1876 2812 4920 6544 6310 4712 4797 4975 5188 5695 6904 8449 10109 11100 11123 9474 8759 8357 6998 5160
3 3354 2142 1407 1467 1550 2387 4241 5663 5386 4657 4788 5065 5384 6093 7226 8850 10314 10491 11239 9599 9026 8531 7142 4686
4 2897 1688 1199 1424 1696 2581 4592 6029 5704 4744 4743 4975 5193 6175 7158 8515 9492 10357 10259 9097 8358 8649 7706 5130
5 2733 1541 1030 1253 1617 2900 4814 6261 6469 5530 5141 5011 5047 5690 6955 8312 9609 10699 10170 9430 9354 9610 8853 6518
6 4537 2864 1864 1555 1551 2162 3642 4766 4942 4401 4801 5174 5426 6258 7235 8612 9444 9929 9263 8405 8117 8567 7852 5946
7 3645 2296 1507 1597 1763 2422 4102 5575 5376 4639 4905 5166 5364 6214 7276 8474 10393 11013 10573 9472 8691 8525 7194 4801
8 2830 1646 1123 1483 1889 3224 5431 7361 7357 5703 5288 5350 5483 6318 7240 8775 9851 10673 9687 8796 8604 8367 6795 4256
9 2657 1724 1222 1480 1871 3168 5802 7592 7519 5895 5406 5443 5496 6419 7877 9220 10270 11910 11449 9804 8909 8665 7499 5203
10 3296 2126 1464 1434 1591 2594 4664 6046 6158 5072 4976 5415 5506 6527 7612 9578 11045 11875 10934 9613 9687 9240 7766 5496
11 3036 1665 1095 1424 1842 2520 4954 6876 6871 5396 5215 5423 5513 6486 7503 8920 10125 10898 10361 9327 8824 8730 7771 5360
12 3227 2147 1393 1362 1757 2710 4576 6250 6231 5177 5157 5319 5570 6448 7743 9390 10734 11713 12216 10393 9965 10310 9992 7945
13 5408 3509 2262 1832 1705 2327 4196 5685 6060 5631 5442 5720 5914 6678 8200 9264 10534 11826 11450 9921 8705 8423 7363 5936
14 3748 2349 1605 1656 1756 2629 4257 5781 5520 4824 4911 5118 5153 5747 6963 8192 9511 10115 9553 9146 9182 8589 6891 4460
15 2497 1515 1087 1381 1862 2980 5050 6837 6729 5201 5347 5517 5503 6997 7633 8505 10285 11959 11728 11032 10509 9105 7153 4480
16 2547 1585 1119 1395 1818 2966 5558 7517 7495 5958 5626 5480 5525 6198 7597 9290 10804 11773 10855 10924 10142 10374 8094 5380
17 3155 2048 1500 1488 1897 2741 4562 6315 5882 4934 5004 5306 5634 6507 7472 8997 10323 11236 11089 9919 9935 9823 8362 5699
18 3390 2135 1332 1626 1892 2959 4688 6618 6451 5377 5150 5487 5490 6383 7534 9040 10274 10692 10338 9551 9310 9285 8015 5492
19 3217 2188 1604 1675 1810 2639 4733 6159 6014 5006 5092 5240 5590 6367 7374 8898 9893 10741 10429 9701 10051 10049 9090 6666
20 4475 3190 2100 1858 1618 2143 3584 4900 5083 4765 5135 5650 5745 6656 7462 8630 9448 10046 9272 8592 8614 8703 7787 5907
21 4294 3194 1972 1727 1926 2615 4185 5727 5529 4707 4911 5212 5465 6085 7064 8127 9483 9817 9291 8317 8107 8245 7362 5231
22 2787 1637 1175 1468 1934 3151 5204 6872 6850 5198 5277 5352 5512 6342 7337 9148 10574 10962 9884 8980 8772 8430 6784 4530
23 2546 1580 1136 1429 1957 3132 5204 6890 6436 5177 5066 5304 5504 6232 7575 9309 9980 10341 10823 11347 11447 10347 8637 5577
24 3200 2055 1438 1493 1798 2754 4484 6013 5913 5146 4947 5311 5229 5974 7083 8706 10366 10786 9772 9080 9213 8831 7480 4456
25 2405 1499 1072 1439 1943 2973 5356 7627 7078 5994 5432 5504 5694 6204 7298 8732 9922 10504 10673 9048 8751 9508 8522 6605
26 3810 3065 2046 1806 1730 2337 3776 5172 5071 4808 5061 5179 5381 6166 7269 8815 9885 10697 10867 10122 9820 10441 9486 7593
27 5196 3635 2352 2055 1723 2336 3539 4937 5053 4771 5198 5732 5839 6820 7519 8803 9793 9838 9228 8267 7908 8507 7720 6046
28 4123 2646 1843 1802 1883 2793 4290 5715 5671 5206 5247 5500 5486 6120 7341 8584 9671 9975 9132 8255 8309 7949 6411 4461
29 2678 1827 1409 1678 1948 3056 5213 6852 6695 5481 5234 5163 5220 6305 7630 9249 10105 11113 10411 9301 9270 9114 6992 4323
30 2401 1510 1112 1403 1841 3216 5757 7596 7611 6064 5987 6090 6423 7249 8396 10243 11554 12126 12561 11024 10836 10042 8275 4723
31 2174 1394 1087 919 773 997 1561 2169 2410 2525 2564 2777 2954 3280 4104 5099 5386 5308 5350 4898 4819 5064 5164 3961
In [ ]: